# -*- coding:utf-8 -*-
# @Auther :shen
# @Time :2022/7/13 20:36
# @Function
# 第一题
lst = ['a', '1', '2bb', '234', '', '9']
# 使用reduce 取出lst里的数字
from functools import reduce
def func(x, y):
    if x.isdigit() and y.isdigit():
        return x * 1 + y
    elif y.isdigit():
        return y
    elif x.isdigit():
        return x


print(reduce(func, lst))

# 第二题
list1 = [7, -8, 5, 4, 0, -2, -5]

print(sorted(list1, key=lambda x: x*-10 +10 if x <= 0 else x))
# 第三题
s='asdf234GDSdsf23'

def func1(str):
    for tmp in str:
        if tmp.isdigit():
            if int(tmp) %2 ==0:
                return (True,True,tmp)
            else:
                return (True,False,tmp)
        else:
            if tmp.isupper():
                return (False,True,tmp)
            else:
                return (False,False,tmp)

print(sorted(s,key=func1))



